package com.atguigu.publisher.service.impl;

import com.atguigu.publisher.mapper.OrderMapper;
import com.atguigu.publisher.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author WangJX
 * @version 1.0
 * @date 2019/12/1 20:11
 */
@Service
public class OrderServiceImpl implements OrderService{
    @Autowired
    private OrderMapper orderMapper;

    //获取总订单数
    @Override
    public Double getOrderTotal(String date) {
        Double total = orderMapper.selectOrderTotal(date);
        return total;
    }

    //求订单分时总数
    @Override
    public Map getOrderDauHour(String date) {
        List<Map> mapList = orderMapper.selectOrderDauHour(date);

        Map<String, String> valueMap = new HashMap();
        for (Map map : mapList) {
            valueMap.put(map.get("CREATE_HOUR").toString(), map.get("CT").toString());
        }
        return valueMap;
    }
}
